<template>
  <div class="catregories">
    <template v-for="(item, index) in categories" key="item.id">
      <div class="cateItem">
        <img :src="item.pictureUrl" alt="" />
        <span class="text">{{ item.title }}</span>
      </div>
    </template>
  </div>
</template>

<script setup>
import { useHomeData } from "@/stores/modules/home"
import { storeToRefs } from "pinia"

const homeData = useHomeData()
homeData.fetchCategoriesData()
const { categories } = storeToRefs(homeData)
</script>

<style lang="less" scoped>
.catregories {
  margin: 5px 0;
  display: flex;
  padding: 8px;
  overflow-x: auto;
  &::-webkit-scrollbar {
    display: none;
  }

  .cateItem {
    display: flex;
    flex-direction: column;
    text-align: center;
    flex-shrink: 0;
    width: 60px;
    img {
      margin: 0 auto;
      width: 30px;
    }
    .text {
      font-size: 10px;
    }
  }
}
</style>
